package com.zhijiang.hospital.controller;

import com.zhijiang.hospital.entity.MedicalTechnollogy;
import com.zhijiang.hospital.service.MedicalTechnologyService;
import com.zhijiang.util.BaseQuery;
import com.zhijiang.util.Result;
import com.zhijiang.util.TimeUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("MedicalTechnology")
@Api(value = "医技运行数据", tags = "医技运行数据")
public class MedicalTechnologyController {


    @Resource
    MedicalTechnologyService medicalTechnologyService;

    //门诊检查
    @ApiOperation("门诊检查分页数据,建议传短时间时间，查询效率比慢，在优化")
    @PostMapping("outpatientExaminations")
    public Result outpatientExaminations(@RequestBody BaseQuery baseQuery) {
        Map<String, Object> outpatientExaminations = medicalTechnologyService.getOutpatientExaminations(TimeUtil.initBaseQuery(baseQuery));
        return Result.ok(outpatientExaminations);
    }

    @ApiModelProperty(value = "获取今年的数据")
    @ApiOperation("获取今年的数据")
    @GetMapping("getYearData")
    public Result getYearData() {
        List<MedicalTechnollogy> yearData = medicalTechnologyService.getYearData();
        return Result.ok(yearData);
    }

    @ApiModelProperty(value = "获取去年的数据")
    @ApiOperation("获取去年的数据")
    @GetMapping("getLastYearData")
    public Result getLastYearData() {
        List<MedicalTechnollogy> yearData = medicalTechnologyService.getLastYearData();
        return Result.ok(yearData);
    }

    public Result getDataChart(String startTime, String endTime) {
        return null;
    }
}
